package com.heima.test;

public class ThreadDemo {

    public static void main(String[] args) throws InterruptedException {
        ThreadLocal<Integer> threadLocal = new ThreadLocal<Integer>(){
            @Override
            protected Integer initialValue() {
                return 0;
            }
        };
        threadLocal.set(threadLocal.get()+1); // 1

        Thread.sleep(1000);


        new Thread(()->{
            System.out.println(threadLocal.get());// 0
        }).start();
    }
}
